/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package TCP;

import Communication.Communica;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author grevin
 */
public class ListenSocket extends Thread {
    
    private BufferedReader in;
    private String lastline = "";
    private Communica com;


    
    public ListenSocket (BufferedReader in){
        super();
        this.in=in;
    }
    public String getLastline(){
        return lastline;
    }
    
    @Override
    public void run(){
        //System.out.println("aaaa");
        while(true){
        try {
            lastline = in.readLine();
            com.getTextRec().setText(lastline);
            //System.out.println(in);
        } catch (IOException ex) {
            Logger.getLogger(ListenSocket.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    }

    public void setCom(Communica com) {
        this.com = com;
    }
    
}
